{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Data preparation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "from utils import (split_dataset_folder, get_filenames_in_folder, convert_image_dataset_to_grayscale, \n",
    "                   download_lsun_dataset)\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATA_ROOT = '/datadrive'\n",
    "\n",
    "HYMENOPTERA_ROOT = os.path.join(DATA_ROOT, 'hymenoptera_data')\n",
    "HYMENOPTERA_GRAY_ROOT = os.path.join(DATA_ROOT, 'hymenoptera_gray')\n",
    "\n",
    "SIMPSONS_ORIGINAL = os.path.join(DATA_ROOT, 'simpsons', 'simpsons_selected')\n",
    "SIMPSONS_ROOT = os.path.join(DATA_ROOT, 'simpsons', 'simpsons')\n",
    "SIMPSONS_GRAY_ROOT = os.path.join(DATA_ROOT, 'simpsons', 'simpsons_gray')\n",
    "\n",
    "DOGS_CATS_ROOT = os.path.join(DATA_ROOT, 'dogs_vs_cats')\n",
    "DOGS_CATS_GRAY_ROOT = os.path.join(DATA_ROOT, 'dogs_vs_cats_gray')\n",
    "\n",
    "#'http://www.vision.caltech.edu/Image_Datasets/Caltech256/256_ObjectCategories.tar'\n",
    "CALTECH256_ORIGINAL = os.path.join(DATA_ROOT, 'caltech256','caltech256_original')\n",
    "CALTECH256_ROOT = os.path.join(DATA_ROOT, 'caltech256','caltech256')\n",
    "CALTECH256_GRAY_ROOT = os.path.join(DATA_ROOT, 'caltech256','caltech256_gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "convert_image_dataset_to_grayscale(HYMENOPTERA_ROOT, HYMENOPTERA_GRAY_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "split_dataset_folder(SIMPSONS_ORIGINAL, SIMPSONS_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "convert_image_dataset_to_grayscale(SIMPSONS_ROOT, SIMPSONS_GRAY_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "convert_image_dataset_to_grayscale(DOGS_CATS_ROOT, DOGS_CATS_GRAY_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "#rm -rf /datadrive/caltech256/caltech256_original/056.dog/greg\n",
    "#rm -rf /datadrive/caltech256/caltech256_original/198.spider/RENAME2\n",
    "split_dataset_folder(CALTECH256_ORIGINAL, CALTECH256_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "convert_image_dataset_to_grayscale(CALTECH256_ROOT, CALTECH256_GRAY_ROOT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
